// post_item.js

import React from "react";
import { getFormatDate } from '../utils/date';
import './post_item.css';
import like from '../images/like.png';

function PostItem(props) {
    const { post } = props;
    const post_id = post.post_id;
    const post_info = post.post_info;

    return (
        <li className="postItem">
            <div className="title">
                {post_info.title}
            </div>
            <div>
                author: <span>{post_info.author.user_name}</span>
            </div>
            <div>
                update time: <span>{getFormatDate(post_info.update_time)}</span>
            </div>
            <div className="like">
                <span>
                    <img alt='vote' src={like} />
                </span>
                <span>
                    {post_info.vote}
                </span>
            </div>
        </li>
    );
}

export default PostItem;
